# Contributor: kpcyrd <git@rxv.cc>
# Maintainer: kpcyrd <git@rxv.cc>
pkgname=cargo-audit
pkgver=0.17.0
pkgrel=0
pkgdesc="Audit Cargo.lock for crates with security vulnerabilities"
url="https://github.com/RustSec/rustsec"
# s390x and riscv64 blocked by cargo
arch="all !s390x !riscv64"
license="MIT OR Apache-2.0"
makedepends="cargo openssl-dev"
subpackages="$pkgname-doc"
options="net"
source="$pkgname-$pkgver.tar.gz::https://github.com/RustSec/cargo-audit/archive/cargo-audit/v$pkgver.tar.gz"
builddir="$srcdir/rustsec-$pkgname-v$pkgver/$pkgname"

export CARGO_PROFILE_RELEASE_LTO="true"
export CARGO_PROFILE_RELEASE_PANIC="abort"
export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1
export CARGO_PROFILE_RELEASE_OPT_LEVEL="s"

prepare() {
	default_prepare

	cargo fetch --locked
}

build() {
	cargo build --release --frozen
}

check() {
	cargo test --frozen
}

package() {
	install -Dm 755 ../target/release/cargo-audit -t "$pkgdir/usr/bin"
	install -Dm 644 -t "$pkgdir/usr/share/doc/cargo-audit" README.md
}

sha512sums="
bff737725e313776048ee04093d58f684af33cdbb0a7c72711418c8db32707ef20f715fde551fff30e93992da5c5f44a0248ff232b79e077e7d69edd46277bca  cargo-audit-0.17.0.tar.gz
"
